<?php

$config = include('config.php');

include __DIR__ . '/framework/Container.php';
include __DIR__ . '/framework/Worker.php';
include __DIR__ . '/framework/Router.php';
include __DIR__ . '/framework/DB.php';
include __DIR__ . '/framework/HTTP.php';
include __DIR__ . '/framework/SimpleHtmlDom.php';

Container::set('config',$config);
Container::set('db', new DB($config['database']));

$worker = new GearmanWorker();
//$gearman->addServer($config['gearman']['host'], $config['gearman']['port']);
$worker->addServer();
//Container::set('gearman', $gearman);

//$router = new Router();
//$router->registerWorker('email', 'Email', __DIR__ . '/worker/Email.php');
//$router->dispatch($argv);

$worker->addFunction("mails", "send_mails");
while ($worker->work());

function send_mails($job){
    return strrev($job->workload());
}

?>
